import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("merchant_id", ["merchantId", "date"], {})
@Entity("merchant_daily_income", { schema: "cabinet" })
export class MerchantDailyIncome {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", {
    name: "merchant_id",
    comment: "商户",
    unsigned: true,
    default: () => "'0'",
  })
  merchantId: number;

  @Column("int", {
    name: "date",
    comment: "每天",
    unsigned: true,
    default: () => "'0'",
  })
  date: number;

  @Column("decimal", {
    name: "amount",
    comment: "总收入",
    precision: 12,
    scale: 2,
    default: () => "'0.00'",
  })
  amount: string;

  @Column("float", {
    name: "energy",
    precision: 15,
    scale: 5,
    default: () => "'0.00000'",
  })
  energy: number;

  @Column("int", {
    name: "time",
    comment: "总充电时长，秒",
    unsigned: true,
    default: () => "'0'",
  })
  time: number;
}
